package cur.nature.framework.mvc.base;

import cur.nature.framework.mvc.http.RequestObject;
import cur.nature.tinyorm.core.bean.PageBean;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;

@EqualsAndHashCode(callSuper=false)
public class BaseAPI {
    @Data
    @Schema(description = "基础查询参数")
    @EqualsAndHashCode(callSuper=false)
    public static class QueryParam extends RequestObject {
    }
    @Data
    @Schema(description = "基础查询返回值")
    public static class QueryResult<T> implements Serializable{
        @Schema(description = "返回列表")
        private List<T> list;
    }

    @Data
    @Schema(description = "基础分页查询参数")
    @EqualsAndHashCode(callSuper=false)
    public static class QueryPageParam extends RequestObject.PageRequest{
    }
    @Data
    @Schema(description = "基础分页查询返回值")
    @EqualsAndHashCode(callSuper=false)
    public static class QueryPageResult<T> extends PageBean<T> implements Serializable{
    }

    @Data
    @Schema(description = "基础保存参数")
    @EqualsAndHashCode(callSuper=false)
    public  static class SaveParam<T> extends RequestObject{
        @Schema(description = "保存对象")
        private T object;
    }
    @Data
    @Schema(description = "基础保存返回值")
    public  static class SaveResult<T> implements Serializable{
        @Schema(description = "影响行数")
        private Integer rows;
        @Schema(description = "保存对象")
        private T object;
    }
    @Data
    @Schema(description = "基础删除参数")
    @EqualsAndHashCode(callSuper=false)
    public static class DeleteParam extends RequestObject{
        @Schema(description = "id列表")
        private List<Integer> idList;
    }
    @Data
    @Schema(description = "基础删除返回值")
    public static class DeleteResult implements Serializable{
        @Schema(description = "影响行数")
        private Integer rows;
    }
}
